package org.ioc.com.mybatis_test.mapper;

import org.apache.ibatis.annotations.*;
import org.ioc.com.mybatis_test.model.UserInfo;

import java.util.List;
@Mapper
public interface UserInfoMapper {
    @Select("select * from userinfo")
    List<UserInfo> getUserAll();

    @Select("select * from userinfo where gender=#{gender}")
    List<UserInfo> getUser1(@Param("gender") Integer num);


    @Insert("insert into userinfo(username, password, age, gender, phone) values(#{username}, #{password}, #{age}, #{gender}, #{phone})")
    Integer insert(UserInfo userInfo);

    @Delete("delete from userinfo where id=#{id}")
    Integer delete(Integer id);


    @Update("update userinfo set gender=2 where username=#{username}")
    Integer update(String username);

}
